package com.chh.nonstandardjson;

public class Token {
    public final TokenType type;
    public final Object value;
    public final int line;
    public final int column;

    public Token(TokenType type, Object value, int line, int column) {
        this.type = type;
        this.value = value;
        this.line = line;
        this.column = column;
    }

    @Override
    public String toString() {
        String valueStr = (value != null) ? value.toString() : "null";
        if (type == TokenType.STRING) {
            valueStr = "\"" + valueStr + "\"";
        }
        return String.format("Token [type=%s, value=%s, line=%d, column=%d]", type, valueStr, line, column);
    }
}